/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucsur.tp.colegio.form;

import edu.ucsur.tp.colegio.beans.GradosBean;
import edu.ucsur.tp.colegio.beans.SedeBean;
import edu.ucsur.tp.colegio.beans.TurnosBean;
import javax.swing.JOptionPane;

/**
 *
 * @author Administrador
 */
public class Ventana_Grados extends javax.swing.JInternalFrame {

    /**
     * Creates new form Ventana_Grados
     */
    public Ventana_Grados() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        cboTurnoGrado = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        cboSede = new javax.swing.JComboBox();
        txtCodigoGrado = new javax.swing.JTextField();
        txtSeccionGrado = new javax.swing.JTextField();
        txtAulaGrado = new javax.swing.JTextField();
        txtGrado = new javax.swing.JTextField();
        btnNuevoGrado = new javax.swing.JButton();
        btnGuardarGrado = new javax.swing.JButton();
        btnModificarGrado = new javax.swing.JButton();
        btneliminarGrado = new javax.swing.JButton();
        btnSalirGrado = new javax.swing.JButton();

        setBackground(new java.awt.Color(0, 204, 204));
        setTitle("REGISTRAR NUEVOS GRADOS");

        jPanel1.setBackground(new java.awt.Color(0, 204, 204));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Ingresar Datos de los Nuevos Grados"));

        jLabel2.setText("Codigo :");

        jLabel7.setText("Sección :");

        jLabel8.setText("Aula :");

        jLabel1.setText("Turno :");

        cboTurnoGrado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccionar...", "Mañana", "Diurno", "Nocturno", " " }));
        cboTurnoGrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cboTurnoGradoActionPerformed(evt);
            }
        });

        jLabel9.setText("Sede :");

        jLabel12.setText("Grado :");

        cboSede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cboSedeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8)
                    .addComponent(jLabel1)
                    .addComponent(jLabel9)
                    .addComponent(jLabel12))
                .addGap(14, 14, 14)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtCodigoGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cboTurnoGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cboSede, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtSeccionGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtAulaGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(38, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtCodigoGrado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(txtSeccionGrado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(txtAulaGrado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(cboTurnoGrado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(cboSede, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtGrado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnNuevoGrado.setText("NUEVO");
        btnNuevoGrado.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnNuevoGrado.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnNuevoGrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoGradoActionPerformed(evt);
            }
        });

        btnGuardarGrado.setText("GUARDAR");
        btnGuardarGrado.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnGuardarGrado.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnGuardarGrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarGradoActionPerformed(evt);
            }
        });

        btnModificarGrado.setText("MODIFICAR");
        btnModificarGrado.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnModificarGrado.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnModificarGrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarGradoActionPerformed(evt);
            }
        });

        btneliminarGrado.setText("ELIMINAR");
        btneliminarGrado.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btneliminarGrado.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btneliminarGrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btneliminarGradoActionPerformed(evt);
            }
        });

        btnSalirGrado.setText("SALIR");
        btnSalirGrado.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnSalirGrado.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnSalirGrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirGradoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnNuevoGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(btnModificarGrado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnGuardarGrado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btneliminarGrado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnSalirGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(32, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnNuevoGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnGuardarGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnModificarGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btneliminarGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnSalirGrado, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cboTurnoGradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboTurnoGradoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cboTurnoGradoActionPerformed

    private void cboSedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboSedeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cboSedeActionPerformed

    private void btnNuevoGradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoGradoActionPerformed

    }//GEN-LAST:event_btnNuevoGradoActionPerformed

    private void btnGuardarGradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarGradoActionPerformed

        try{
            //--** Instanciando una clase del Servicio Grados (JavaBean)
            
            GradosBean grados = new GradosBean();
            
            grados.setTxtCodigoGrado(txtCodigoGrado.getText());
            grados.setTxtSeccionGrado(txtSeccionGrado.getText());
            grados.setTxtAulaGrado(txtAulaGrado.getText());
            grados.setCboTurnoGrado(new TurnosBean((String) cboTurnoGrado.getSelectedItem(), ""));
            grados.setcboSedeGrado(new SedeBean((String) cboSede.getSelectedItem(), ""));
            grados.setTxtGrado(txtGrado.getText());
                        
            
        }catch (Exception ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(null, "Se Grabo Correctamente El Mantenimiento Grados ");
    }
        
    }//GEN-LAST:event_btnGuardarGradoActionPerformed

    private void btnModificarGradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarGradoActionPerformed

    }//GEN-LAST:event_btnModificarGradoActionPerformed

    private void btneliminarGradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarGradoActionPerformed

    }//GEN-LAST:event_btneliminarGradoActionPerformed

    private void btnSalirGradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirGradoActionPerformed
 this.dispose();
    }//GEN-LAST:event_btnSalirGradoActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnGuardarGrado;
    private javax.swing.JButton btnModificarGrado;
    private javax.swing.JButton btnNuevoGrado;
    private javax.swing.JButton btnSalirGrado;
    private javax.swing.JButton btneliminarGrado;
    private javax.swing.JComboBox cboSede;
    private javax.swing.JComboBox cboTurnoGrado;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField txtAulaGrado;
    private javax.swing.JTextField txtCodigoGrado;
    private javax.swing.JTextField txtGrado;
    private javax.swing.JTextField txtSeccionGrado;
    // End of variables declaration//GEN-END:variables
}
